package com.cskaoyan.controller;

import com.cskaoyan.bean.AdminListRespVo;
import com.cskaoyan.bean.GoodsStatBean;
import com.cskaoyan.bean.OrderStatBean;
import com.cskaoyan.bean.UserStatBean;
import com.cskaoyan.lz_service.UserService;
import com.cskaoyan.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.jws.Oneway;

/**
 * @USER: cuiweiguo#
 * @DATE: 2022/5/7
 * @TIME: 9:36
 * @PROJECT_NAME: mallproject2
 */
@RestController
@RequestMapping("admin/stat")
public class StatController {
    @Autowired
    UserService userService;
    @Autowired
    OrderService orderService;

    @RequestMapping("user")
    public AdminListRespVo<UserStatBean> user() {
        //GET http://182.92.235.201:8083/admin/stat/user HTTP/1.1
        UserStatBean userStatBean = userService.statUser();
        return AdminListRespVo.listOk(userStatBean);
    }

    @RequestMapping("goods")
    public AdminListRespVo<UserStatBean> goods() {
        //GET http://182.92.235.201:8083/admin/stat/user HTTP/1.1
        GoodsStatBean goodsStatBean = orderService.statOrderGoods();

        return AdminListRespVo.listOk(goodsStatBean);
    }

    @RequestMapping("order")
    public AdminListRespVo<UserStatBean> order() {
        //GET http://182.92.235.201:8083/admin/stat/user HTTP/1.1
        OrderStatBean orderStatBean = orderService.order();

        return AdminListRespVo.listOk(orderStatBean);
    }
}
